const Router = require('koa-router')

const { register, login, ChangePassword } = require('../controller/user_controller')

const { userVaildator, userVerify, crpytPassword, loginVerify } = require('../middleware/user_middleware')
const { UpdateUserinfo } = require('../service/user_service')

const { auth } = require('../middleware/auth_middleware')
const router = new Router({ prefix: '/users' })

//GET '/users/
//用户注册
router.post('/register', userVaildator, userVerify, crpytPassword, register)

//用户登录
router.post('/login', userVaildator, loginVerify, login)

//修改密码接口
router.patch('/', auth, crpytPassword, ChangePassword)

router.get('/', (ctx, next) => {
    ctx.body = 'hello'


})
module.exports = router